import preprocessingfile as preprocess
import models
from sklearn.ensemble import StackingClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.svm import SVC
from sklearn.tree import DecisionTreeClassifier
from sklearn.metrics import accuracy_score

# 加载数据
data = 'NASADefectDataset-master\\CleanedData\\MDP\\D\'\\PC3.arff'
original_data, original_X, original_Y,combined_training_data,x_train1,x_train2,x_train,x_test,x_val,y_train1,y_train2,y_train,y_test,y_val = preprocess.my_sdp_preprocessor(data)
all_data = [original_data, original_X, original_Y,combined_training_data,x_train1,x_train2,x_train,x_test,x_val,y_train1,y_train2,y_train,y_test,y_val]

def stacking_models(base_models, meta_model):
    stacking_clf = StackingClassifier(
        estimators=base_models,
        final_estimator=meta_model
    )
    stacking_clf.fit(x_train, y_train)
    return stacking_clf

